Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

py: use subprocess to read with timeout #11

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

milahu
Copy link
Owner

@milahu milahu commented Mar 11, 2024

@mkoeppe please check before we merge this. ./py/test/test.sh looks good

previously i wanted to avoid "subprocess to read with timeout"
but starting a new python interpreter from python uses almost no extra memory
because the python executable is shared memory
so this uses even less memory than calling the dd executable (5MB RSS)

same python interpreter instance running multiple scripts simultaneously

when you run two or more copies of the interpreter, the second and subsequent will share most of the memory (at least for executable code) with the first, so resource usage will not rise (anywhere close to) linearly as you run more instances.

pros:

cons:

  • may be slower than the previous solution, but this is no hot code

_parse_exception is needed to handle unexpected errors from the python subprocess

@@ -27,11 +72,9 @@ def __init__(
max_load: int | None = None,
debug: bool | None = None,
debug2: bool | None = None,
use_cysignals: bool | None = None,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be easier for the use in Sage if we could accept (and ignore) use_cysignals for a while

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just help yourself : )
i dont use this, just sharing my drafts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

py: fix read with timeout on windows
2 participants